package  
{
	/**
	 * ...
	 * @author Martina Rasch
	 */
	
	import net.flashpunk.Entity;
	import net.flashpunk.graphics.Text;
	 
	public class Scoretable extends Entity
	{
		private var yourScore:Text;
		private var nscore:Text;
		
		private var p:Text;
		private var s:Text;
		
		private var score:Array;
		private var names:Array;
		
		public function Scoretable(scores:Array, players:Array, newScore:int, index:int) 
		{
			score = scores;
			names = players;
			yourScore = new Text("Your Score:", 320, 50, 300, 60);
			if (index > -1) {
				yourScore = new Text("New Score!", 335, 50, 300, 60);
			}
			addGraphic(yourScore);
			yourScore.color = 0xFFFFFF;
			yourScore.size = 30;
			addGraphic(yourScore);
			
			nscore = new Text(newScore + "", 400, 100, 300, 60);
			if (newScore == -1) {
				nscore = new Text(0 + "", 400, 100, 300, 60);
			}
			addGraphic(nscore);
			nscore.color = 0xFFFFFF;
			nscore.size = 30;
			addGraphic(nscore);
			
			for (var i:int = 0; i < score.length; i++) {
				if (i != index) {
					p = new Text(names[i], 110, 200+ i *60, 400, 50);
					addGraphic(p);
					p.color = 0xFFFFFF;
					p.size = 50;
					addGraphic(p);
				}
				
				s = new Text(score[i], 520, 200+ i *60, 200, 50);
				addGraphic(s);
				s.color = 0xFFFFFF;
				s.size = 50;
				addGraphic(s);
				
			}
			
		}
		
	}

}